//***********************************************************************
//*                                                                     *
//*                  Copyright (c) 1985-2022, AMI.                      *
//*                                                                     *
//*      All rights reserved. Subject to AMI licensing agreement.       *
//*                                                                     *
//***********************************************************************
/**@file
 * This file contains the Spi Handling functions
 */

#ifndef SPI_H_
#define SPI_H_

#include <stdlib.h>
#include <stddef.h>
#include <string.h>

/**
 * Spi Interface
 */
struct SpiInterface {
	/**
	 * Function to read data in SPI port.
	 *
	 * @param  Spi Interface
	 *
	 * @return 0 
	 */
	int (*SpiRead  ) ();
	
	/**
	 * Function to write data in SPI port 
	 *
	 * @param  Spi Interface
	 *
	 * @return 0 
	 */
	int (*SpiWrite  ) ();
	/**
	 * Function to erase the particular chip of size 4k.
	 *
	 * @param  Spi Interface
	 *
	 * @return 0 
	 */
	int (*SpiErase  ) ();
	
	/**
	 * Function to read the data using DMA mode.
	 *
	 * @param  Spi Interface
	 *
	 * @return 0 
	 */
	int (*SpiDmaRead ) ();
};

int SpiInit (struct SpiInterface *Spi);
/**
 * Error codes that can be generated by a SPI.
 */
enum {
	SPI_INVALID_ARGUMENT = 0x00		/**< Input parameter is null or not valid. */
};

#endif /* SPI_H_ */
